package com.dianping.cat.core.dal;

import org.unidal.dal.jdbc.DataField;
import org.unidal.dal.jdbc.QueryDef;
import org.unidal.dal.jdbc.QueryType;
import org.unidal.dal.jdbc.Readset;
import org.unidal.dal.jdbc.Updateset;
import org.unidal.dal.jdbc.annotation.Attribute;
import org.unidal.dal.jdbc.annotation.Entity;
import org.unidal.dal.jdbc.annotation.Variable;

@Entity(logicalName = "task", physicalName = "task", alias = "t")
public class TaskEntity
{
  @Attribute(field = "id", nullable = false, primaryKey = true, autoIncrement = true)
/*  16 */   public static final DataField ID = new DataField("id");
  
  @Attribute(field = "producer", nullable = false)
/*  19 */   public static final DataField PRODUCER = new DataField("producer");
  
  @Attribute(field = "consumer")
/*  22 */   public static final DataField CONSUMER = new DataField("consumer");
  
  @Attribute(field = "failure_count", nullable = false)
  public static final DataField FAILURE_COUNT = new DataField("failure-count");
  
  @Attribute(field = "report_name", nullable = false)
/*  28 */   public static final DataField REPORT_NAME = new DataField("report-name");
  
  @Attribute(field = "report_domain", nullable = false)
  public static final DataField REPORT_DOMAIN = new DataField("report-domain");
  
  @Attribute(field = "report_period", nullable = false)
/*  34 */   public static final DataField REPORT_PERIOD = new DataField("report-period");
  
  @Attribute(field = "status", nullable = false)
/*  37 */   public static final DataField STATUS = new DataField("status");
  
  @Attribute(field = "task_type", nullable = false)
/*  40 */   public static final DataField TASK_TYPE = new DataField("task-type");
  
  @Attribute(field = "creation_date", nullable = false)
/*  43 */   public static final DataField CREATION_DATE = new DataField("creation-date");
  
  @Attribute(field = "start_date")
/*  46 */   public static final DataField START_DATE = new DataField("start-date");
  
  @Attribute(field = "end_date")
/*  49 */   public static final DataField END_DATE = new DataField("end-date");
  
  @Attribute(field = "", selectExpr = "COUNT(*)")
/*  52 */   public static final DataField COUNT = new DataField("count");
  
  @Variable
/*  55 */   public static final DataField KEY_ID = new DataField("key-id");
  
  @Variable
/*  58 */   public static final DataField START_LIMIT = new DataField("start-limit");
  
  @Variable
/*  61 */   public static final DataField END_LIMIT = new DataField("end-limit");

/*  63 */   public static final Readset<Task> READSET_FULL = new Readset(new DataField[] { ID, PRODUCER, CONSUMER, FAILURE_COUNT, REPORT_NAME, REPORT_DOMAIN, REPORT_PERIOD, STATUS, TASK_TYPE, CREATION_DATE, START_DATE, END_DATE });

/*  65 */   public static final Readset<Task> READSET_REPORT_DOMAIN = new Readset(new DataField[] { REPORT_DOMAIN });

/*  67 */   public static final Readset<Task> READSET_REPORT_NAME = new Readset(new DataField[] { REPORT_NAME });

/*  69 */   public static final Readset<Task> READSET_REPORT_NAME_DOMAIN = new Readset(new DataField[] { REPORT_DOMAIN, REPORT_NAME });

/*  71 */   public static final Readset<Task> READSET_COUNT = new Readset(new DataField[] { COUNT });

/*  73 */   public static final Updateset<Task> UPDATESET_FULL = new Updateset(new DataField[] { ID, PRODUCER, CONSUMER, FAILURE_COUNT, REPORT_NAME, REPORT_DOMAIN, REPORT_PERIOD, STATUS, TASK_TYPE, CREATION_DATE, START_DATE, END_DATE });

/*  75 */   public static final QueryDef FIND_BY_PK = new QueryDef("findByPK", TaskEntity.class, QueryType.SELECT, "SELECT <FIELDS/> FROM <TABLE/> WHERE <FIELD name='id'/> = ${key-id}");


  public static final QueryDef INSERT = new QueryDef("insert", TaskEntity.class, QueryType.INSERT, "INSERT IGNORE INTO <TABLE/> (<FIELDS/>) VALUES (<VALUES/>)");


/*  81 */   public static final QueryDef UPDATE_BY_PK = new QueryDef("updateByPK", TaskEntity.class, QueryType.UPDATE, "UPDATE <TABLE/> SET <FIELDS/> WHERE <FIELD name='id'/> = ${key-id}");


/*  84 */   public static final QueryDef DELETE_BY_PK = new QueryDef("deleteByPK", TaskEntity.class, QueryType.DELETE, "DELETE FROM <TABLE/> WHERE <FIELD name='id'/> = ${key-id}");


/*  87 */   public static final QueryDef FIND_BY_STATUS_CONSUMER = new QueryDef("findByStatusConsumer", TaskEntity.class, QueryType.SELECT, "SELECT <FIELDS/> FROM <TABLE/> WHERE <FIELD name='status'/> = ${status} <IF type='NOT_NULL' field='consumer'> AND <FIELD name='consumer'/> = ${consumer} </IF> limit 1");


/*  90 */   public static final QueryDef UPDATE_TODO_TO_DOING = new QueryDef("updateTodoToDoing", TaskEntity.class, QueryType.UPDATE, "UPDATE <TABLE/> SET <FIELD name='consumer'/>=${consumer}, <FIELD name='status'/>=2, <FIELD name='start-date'/>=${start-date} WHERE <FIELD name='status'/> = 1 AND <FIELD name='id'/> = ${id};");


/*  93 */   public static final QueryDef UPDATE_DOING_TO_DONE = new QueryDef("updateDoingToDone", TaskEntity.class, QueryType.UPDATE, "UPDATE <TABLE/> SET <FIELD name='status'/>=3, <FIELD name='end-date'/>=${end-date} WHERE <FIELD name='status'/> = 2 AND <FIELD name='id'/> = ${id};");


/*  96 */   public static final QueryDef UPDATE_FAILURE_TO_DONE = new QueryDef("updateFailureToDone", TaskEntity.class, QueryType.UPDATE, "UPDATE <TABLE/> SET <FIELD name='status'/>=3, <FIELD name='end-date'/>=${end-date} WHERE <FIELD name='status'/> =4 AND <FIELD name='id'/> = ${id};");


/*  99 */   public static final QueryDef UPDATE_STATUS_TO_TODO = new QueryDef("updateStatusToTodo", TaskEntity.class, QueryType.UPDATE, "UPDATE <TABLE/> SET <FIELD name='status'/>=1, WHERE <FIELD name='id'/> = ${id};");


/* 102 */   public static final QueryDef UPDATE_DOING_TO_FAIL = new QueryDef("updateDoingToFail", TaskEntity.class, QueryType.UPDATE, "UPDATE <TABLE/> SET <FIELD name='status'/>=4, <FIELD name='end-date'/>=${end-date}, <FIELD name='failure-count'/> = <FIELD name='failure-count'/> + 1 WHERE <FIELD name='status'/> = 2 AND <FIELD name='id'/> = ${id};");
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-core-3.0.0.jar!/com/dianping/cat/core/dal/TaskEntity.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */